using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace UM_Model.Models.Mapping
{
    public class TopicMap : EntityTypeConfiguration<Topic>
    {
        public TopicMap()
        {
            // Primary Key
            this.HasKey(t => t.TopicID);

            // Properties
            this.Property(t => t.Name)
                .HasMaxLength(100);

            this.Property(t => t.Thumbnail)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("Topics");
            this.Property(t => t.TopicID).HasColumnName("TopicID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Thumbnail).HasColumnName("Thumbnail");
            this.Property(t => t.IsEnable).HasColumnName("IsEnable");
        }
    }
}
